/**
 * 
 */
package org.statewalker.parser.wiki.tokenizer.base;

import org.statewalker.validator.AbstractGrammar;
import org.statewalker.validator.AbstractValidator;
import org.statewalker.validator.IParseKey;

/**
 * @author kotelnikov
 */
public class TextBaseGrammar extends AbstractGrammar {

    public final IParseKey S_EOL = newKey("#EOL");

    public final IParseKey S_SPACE = newKey("#SPACE");

    public final IParseKey S_SYMBOLS = newKey("#SYMBOLS");

    public final IParseKey S_WORD = newKey("#WORD");

    public TextBaseGrammar(AbstractValidator<?, ?> validator) {
        super(validator);
    }

    protected IParseKey getParent() {
        return getROOT();
    }

    @Override
    public void init() {
        initEOL();
        initSPACE();
        initSYMBOLS();
        initWORD();
    }

    private void init(IParseKey key) {
        IParseKey parent = getParent();
        defineParent(key, parent);
        defineSubstates(parent, key);
    }

    protected void initEOL() {
        init(S_EOL);
    }

    protected void initSPACE() {
        init(S_SPACE);
    }

    protected void initSYMBOLS() {
        init(S_SYMBOLS);
    }

    protected void initWORD() {
        init(S_WORD);
    }

}